<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>

<body>
    <script>

        function getData(url = '', params = {}) {
            return $.ajax({ url, data: params })

        }


        //    let res1= getData('https://locally.uieee.com/slides')    
        //   console.log(res1)


        //   async     怎么样直接获取到异步的promise 的结果

        // let res=     getData('https://locally.uieee.com/slides')    

        async function fn() {
     
        var res1 = await getData('https://locally.uieee.com/slides')
        var res2 = await getData('https://locally.uieee.com/categories')
        var res3 = await getData('https://locally.uieee.com/slides')
        var res4 = await getData('https://locally.uieee.com/categories')

            
            var  res5 = await getData('https://locally.uieee.com/slides')
            var  res6 = await getData('https://locally.uieee.com/categories')

            var  res7 = await getData('https://locally.uieee.com/categories')

            var  res8 = await getData('https://locally.uieee.com/slides')
            var  res9 = await getData('https://locally.uieee.com/categories')
              
          } 
            console.log(res1)
            console.log(res2)
            console.log(res3)
            console.log(res4)   
            console.log(res5)
            console.log(res6)
            console.log(res7)    
            console.log(res8)
            console.log(res9)



        

        fn()





        //  async  await    第一 es7 的语法     
        //  async  可以单独使用 但是  await  必须要和async 一起使用   不能单独使用 
        // await  必须跟一个promise 对象      返回的结果是promise resolve 的结果
    </script>
</body>

</html>